# Maintainer: Muflone http://www.muflone.com/contacts/english/

pkgname=perl-gtk3-imageview
_perl_namespace=Gtk3
_perl_module=ImageView
pkgver=10
pkgrel=3
pkgdesc="Image viewer widget for Gtk3"
arch=('any')
url="https://metacpan.org/release/${_perl_namespace}-${_perl_module}"
license=('LGPL')
depends=('perl-gtk3' 'imagemagick')
checkdepends=('perl-test-exception' 'perl-test-memory-cycle' 'perl-try-tiny'
              'perl-readonly' 'perl-test-mockobject' 'perl-test-differences'
              'perl-test-deep' 'perl-carp-always' 'xorg-server-xvfb')
source=("https://cpan.metacpan.org/authors/id/A/AS/ASOKOLOV/${_perl_namespace}-${_perl_module}-${pkgver}.tar.gz")
sha512sums=('2548c33c49c27bb4a69d5512c7dfaca096a39ef6d08fa1deb83a045e6c5b7ad075eb8b23b33fb794024c9b9e7fd979a5c31bff075a7ed5412a4a5a4f53824f5a')
options=('!emptydirs')

build() {
  cd "${_perl_namespace}-${_perl_module}-${pkgver}"
  unset PERL5LIB PERL_MM_OPT PERL_MB_OPT PERL_LOCAL_LIB_ROOT
  export PERL_MM_USE_DEFAULT=1 PERL_AUTOINSTALL=--skipdeps
  perl Makefile.PL
  make
}

check() {
  cd "${_perl_namespace}-${_perl_module}-${pkgver}"
  unset PERL5LIB PERL_MM_OPT PERL_MB_OPT PERL_LOCAL_LIB_ROOT
  export PERL_MM_USE_DEFAULT=1
  xvfb-run -a -s "-extension GLX -screen 0 1280x1024x24" make test
}

package() {
  cd "${_perl_namespace}-${_perl_module}-${pkgver}"
  unset PERL5LIB PERL_MM_OPT PERL_MB_OPT PERL_LOCAL_LIB_ROOT
  make pure_install INSTALLDIRS=vendor DESTDIR="${pkgdir}"
  # Delete unuseful files
  find "${pkgdir}" -name '.packlist' -delete
}
